package chapter13.Z1;

import java.util.Scanner;

public class Str1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String s1 = sc.next();
        System.out.println("请输入要查找的字符串：");
        String s2 = sc.next();
        int count = 0;
        int index = 0;
        while (s1.indexOf(s2,index)!=-1){
            index=s1.indexOf(s2,index)+s2.length();
            count++;
        }
        System.out.println("有"+count+"次");
    }
}
